/**
 * Applikationsutveckling i Java, 5DV135
 * HT12
 * Project
 *
 * File: nullInvader.Engine.Map.java
 * Description: A class for representing a map.
 * Date: 13 december 2012
 *
 * cs-user: dv11rlm
 * @author Robert Lundström
 */
package nullInvader.Engine;

import java.awt.Point;
import java.util.ArrayList;
import java.util.concurrent.ConcurrentHashMap;

public class Map {

    //
    // Fields
    //

    protected final ConcurrentHashMap<Point, Zone> grid;
    protected final ArrayList<Point> goalPosition;
    protected final Point startPosition;
    protected final int goalScore;
    protected final int startCash;
    protected final String mapName;
    protected final ArrayList<UnitInfo> unitPriceList;
    protected final ArrayList<Tower> towerList;

    /**
     * Constructor that initialize all needed values in class.
     *
     * @param map
     * @param mapName
     * @param goalScore
     * @param startCash
     * @param start
     * @param goal
     * @param unitPriceList
     * @param towerList
     */
    public Map(ConcurrentHashMap<Point, Zone> map, String mapName,
        int goalScore, int startCash, Point start, ArrayList<Point> goal,
        ArrayList<UnitInfo> unitPriceList, ArrayList<Tower> towerList) {

    grid = map;
    startPosition = start;
    goalPosition = goal;
    this.goalScore = goalScore;
    this.startCash = startCash;
    this.mapName = mapName;
    this.unitPriceList = unitPriceList;
    this.towerList = towerList;
    }

    //
    // Methods
    //

    /**
     * returns a array with all towers on the map.
     *
     * @see Tower
     * @return ArrayList<Tower>
     */
    public ArrayList<Tower> getTowerList() {
    return towerList;
    }

    /**
     * Get a zone from point p in the field.
     *
     * @param p
     * @return Zone the zone at point in grid.
     */
    public Zone getZone(Point p) {
    return grid.get(p);
    }

    /**
     * returns the position of the goal.
     *
     * @return Point goalPosition
     */
    public ArrayList<Point> getGoal() {
    return goalPosition;
    }

    /**
     * returns the position of the start.
     *
     * @return Point startPosition
     */
    public Point getStart() {
    return startPosition;
    }

    /**
     * returns the name for current map.
     *
     * @return String mapName
     */
    public String getName() {
    return mapName;
    }

    /**
     *
     * @return int startcash
     */
    public int getStartCash() {
    return startCash;
    }

    /**
     * @return int
     */
    public int getGoalScore() {
    return goalScore;
    }

    /**
     * returns a list of objects containing name of the unit and the
     * price to buy it for the current map.
     *
     * @see UnitInfo ,ArrayList
     * @return ArrayList<UnitInfo>
     */
    public ArrayList<UnitInfo> getUnitPrices() {
    return unitPriceList;
    }

}
